# load description data
setwd("~/Dropbox/FuHowell_Filibuster_Replication/data/FloorSpeech/descr/")
filenames_d <- list.files(pattern = "descr_")
descr_list <- lapply(filenames_d, function(x) fread(file = x, sep = "|", header = TRUE))
descr <- bind_rows(descr_list, .id = "congress")
library(tidyverse)
library(data.table)
library(lubridate)
library(lfe)
library(stargazer)
library(ggthemes)
# load description data
setwd("~/Dropbox/FuHowell_Filibuster_Replication/data/FloorSpeech/descr/")
filenames_d <- list.files(pattern = "descr_")
descr_list <- lapply(filenames_d, function(x) fread(file = x, sep = "|", header = TRUE))
descr <- bind_rows(descr_list, .id = "congress")
# load speaker data
setwd("~/Dropbox/FuHowell_Filibuster_Replication/data/FloorSpeech/speaker/")
filenames_s <- list.files(pattern = "_SpeakerMap.txt")
speaker_list <- lapply(filenames_s, function(x) fread(file = x, sep = "|", header = TRUE))
speaker <- bind_rows(speaker_list)
rm(filenames_d, descr_list, filenames_s, speaker_list)
View(speaker)
setwd("~/Dropbox/FuHowell_Filibuster_Replication/data/")
write_csv(descr, "descr.csv")
head(descr)
write_speaker(speaker, "speaker.csv")
write_csv(speaker, "speaker.csv")
### Raw Data Loading ###
setwd("~/Dropbox/FuHowell_Filibuster_Replication/data/")
# load description data
descr <- read_csv("descr.csv")
# load speaker data
speaker <- read_csv("speaker.csv")
# load senate minority party
min_party <- read_csv("min_party.csv")
# load congressional seats over time
seat <- read_csv("seat.csv")
# load cloture motion data
cloture <- read_csv("cloture.csv")
# load DW-NOMINATE scores
dw_nominate_raw <- read_csv("HSall_members_new.csv")
dw_nominate <- dw_nominate_raw %>%
select(congress, chamber, state_abbrev, district_code, bioname, nominate_dim1) %>%
mutate(state_abbrev = as.character(state_abbrev),
district_code = as.character(district_code)) %>%
filter(chamber == "House" | chamber == "Senate") %>%
filter(congress >= 43 & congress <= 114)
dw_quantile <- dw_nominate %>%
group_by(congress, chamber) %>%
summarize(quantile25 = quantile(nominate_dim1, probs = 0.25, na.rm = T),
quantile75 = quantile(nominate_dim1, probs = 0.75, na.rm = T))
dw_nominate_merge <- dw_nominate %>%
mutate(bioname = toupper(bioname)) %>%
mutate(lastname = str_split(bioname, ",", simplify = T)[,1]) %>%
mutate(lastname = gsub("'", "", lastname)) %>%   # O'BRIEN
mutate(lastname = gsub("Á", "A", lastname)) %>%  # FERNÁNEZ
mutate(lastname = gsub("É", "E", lastname)) %>%  # GUTIÉRREZ
mutate(lastname = gsub("Í", "I", lastname)) %>%  # MARTÍNES
mutate(lastname = ifelse(bioname == "BONO, MARY", "BONO MACK", lastname)) %>%
mutate(lastname = ifelse(bioname == "LONG, JILL LYNETTE", "LONG THOMPSON", lastname)) %>%
left_join(dw_quantile) %>%
mutate(ideology = ifelse(nominate_dim1 > quantile25 & nominate_dim1 < quantile75, "moderate", "extreme")) %>%
mutate(chamber = ifelse(chamber == "Senate", "S", "H")) %>%
select(congress, chamber, state = state_abbrev, district_code, bioname, lastname, nominate_dim1, ideology) %>%
arrange(congress, chamber, district_code)
rm(dw_nominate_raw, dw_nominate, dw_quantile)
# merging and filtering for both Senate and House
speech <- descr %>%
filter(chamber == "S" | chamber == "H") %>%
mutate(congress = as.numeric(congress) + 42) %>%
select(-state, -gender) %>%
left_join(speaker) %>%
left_join(min_party) %>%
select(-number_within_file, -line_start, -line_end, -file) %>%
filter(!is.na(speakerid)) %>%
filter(nonvoting == "voting") %>% # drop all non-voting legislators
filter(word_count >= 30) %>% # drop all non-substantive speeches
mutate(speakerid2 = speakerid - congress * 1000000) %>% # create a speaker-specific id
mutate(year = format(ymd(date), format = "%Y"))
# Create legislator-by-year panel data
speech_panel <- speech %>%
group_by(speakerid2, firstname, lastname, chamber, state, district, party, min_party_s, min_party_h, year, congress) %>%
summarize(word_count = sum(word_count)) %>%
mutate(log_word = log(word_count)) %>%
mutate(post1917S = ifelse(year >= 1917 & chamber == "S", 1, 0)) %>%
mutate(post1975S = ifelse(year >= 1975 & chamber == "S", 1, 0)) %>%
mutate(post2007S = ifelse(year >= 2007 & chamber == "S", 1, 0)) %>%
mutate(post1889H = ifelse(year >= 1889 & congress != 52 & chamber == "H", 1, 0)) %>%
mutate(congressXchamber = paste0(congress, chamber)) %>%
mutate(min = ifelse(chamber == "S" & party == min_party_s, 1,
ifelse(chamber == "H" & party == min_party_h, 1, 0)))
speech_panel2 <- speech_panel %>%
left_join(dw_nominate_merge, by = c("congress", "chamber", "state", "lastname"))
# Cloture Adoption in 1917
mod1917_1 <- felm(log_word ~ post1917S + as.factor(year) | speakerid2 | 0 | congressXchamber, data = speech_panel[speech_panel$congress %in% c(64:65),])
mod1917_2 <- felm(log_word ~ post1917S + as.factor(year) | speakerid2 | 0 | congressXchamber, data = speech_panel[speech_panel$congress %in% c(63:66),])
mod1917_3 <- felm(log_word ~ post1917S + as.factor(year) | speakerid2 | 0 | congressXchamber, data = speech_panel[speech_panel$congress %in% c(62:67),])
mod1917_4 <- felm(log_word ~ post1917S + as.factor(year) | speakerid2 | 0 | congressXchamber, data = speech_panel[speech_panel$congress %in% c(61:68),])
mod1917_5 <- felm(log_word ~ post1917S + as.factor(year) | speakerid2 | 0 | congressXchamber, data = speech_panel[speech_panel$congress %in% c(60:69),])
stargazer(mod1917_1, mod1917_2, mod1917_3, mod1917_4, mod1917_5,
type = "text",
omit = "factor", omit.stat = c("adj.rsq", "f", "ser"),
title = "Congressional Floor Speech Length and Rule Change on Filibuster in 1917",
dep.var.caption = c("Dependent Variable: Log Word Counts"),
column.labels = c("1 session", "2 sessions", "3 sessions", "4 sessions", "5 sessions"),
column.separate = c(1, 1, 1, 1, 1),
dep.var.labels = c("Cloture Adoption in 1917"),
add.lines = list(c("Legislator FE", "Yes", "Yes", "Yes", "Yes", "Yes"),
c("Year FE", "Yes", "Yes", "Yes", "Yes", "Yes")))
